﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class SoftDownListMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.SoftDownList>
    {
        public SoftDownListMap()
        {
            // table
            //ToTable("CMS_SoftDownList");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.ModelId)
                
                .IsRequired();
            Property(t => t.SoftId)
                
                .IsRequired();
            Property(t => t.ServerId)
                
                .IsRequired();
            Property(t => t.FileName)
                
                .HasMaxLength(200)
                .IsRequired();
            Property(t => t.DownLinkName)
                
                .HasMaxLength(200)
                .IsRequired();

            // Relationships
            HasRequired(t => t.Soft)
                .WithMany(t => t.SoftDownLists)
                .HasForeignKey(d => d.SoftId);
            HasRequired(t => t.ServerSoftServer)
                .WithMany(t => t.ServerSoftDownLists)
                .HasForeignKey(d => d.ServerId);

            //InitializeMapping();
        }
    }
}

